<template>
  <div class="bg">
    <nav-com
      :title="$t('modifiedWeight')"
      :showView='showView'
      @back="backHandler()"
    ></nav-com>
    <div class="top-view1">
      <van-row  class="m-b-10 m-t-10 topContent">
        <van-col span="16" class="fontStyle">{{ $t('modifiedWeight') }}</van-col>
        <van-col span="8"  class="fontStyle_te" style="text-align: right">{{ $t('unit') }}:lbs</van-col>
      </van-row>
      <van-cell-group inset class="m-b-10">
        <van-field
          v-model="fatValue"
          label=""
          :placeholder="$t('enterWeight')"
          input-align="left"

        />
      </van-cell-group>
      <div  class='fatSubmit'>
        <van-button round type="info" class="fatSubmit_yanse" block @click="submintname()">{{ $t('accomplish') }}</van-button>
      </div>
    </div>
  </div>
</template>
<script>
import { Toast } from 'vant';
import navCom from "@/components/nav-com.vue";
import {profile} from "../../api/user";
export default {
  name: "fatYourself",
  components: {
    navCom,
  },
  data() {
    return {
      showView:true,
      fatValue:'',
      title:'修改体重'
    };
  },
  mounted() {
    this.fatValue = this.$route.query.canshu
    console.log("=this.$route.query.canshu",this.$route.query.canshu)
    this.init();
  },
  methods: {
    //返回
    backHandler() {
      this.$router.go(-1);
    },
    //初始化
    init() {

    },
    submintname(){
      profile({weight:this.fatValue}).then((res)=>{
        if(res.code==1){
          this.$toast(res.msg)
          const nav = navigator.userAgent
          if (nav.indexOf('Android') > -1 || nav.indexOf('Adr') > -1) {
            phone.userInfoEdit()
          } else if (nav.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) {
            setTimeout(() => {
              this.$bridge.callhandler('userInfoEdit', {}, res => {})
            })
          }
          setTimeout(()=>{
            this.backHandler()
          },500)
        }
      })
    }
  },
};
</script>
<style lang="scss" scoped>
.top-view1{
  margin-top: 26.23vw;
}
.m-b-10{
  margin-bottom: 10px;
}
.m-t-10{
  margin-top: 10px;
}
.topContent{
  margin: 0.8rem 0.42667rem 10px;
}
.fontStyle{
  font-size: 18px;
  font-family:PingFang, PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color:#303030
}
.fontStyle_te{
  font-size: 18px;
  font-family:PingFang, PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #808080;
}
.fatSubmit{
  padding: 0.3rem 0.42667rem 10px;
  .fatSubmit_yanse{
    border: 0px!important;
    background: linear-gradient(90deg, #1ED6C2 0%, #00DEA1 100%);
    box-shadow: 0px 2px 4px 0px rgba(10,211,159,0.3);
    font-size: 18px!important;
    font-weight: 600;
  }

}
::v-deep .van-cell{
  font-size:20px!important;
  font-family: PingFang;
}
</style>
